import request from '@/utils/request.js';
import {useTokenStore} from "@/stores/token.js";

//日程分类列表查询
export const scheduleCategoryListService = () => {
    return request.get('/schedule-category')
}

//日程分类添加
export const scheduleCategoryAddService = (categoryData) => {
    return request.post('/schedule-category', categoryData)
}

//日程分类修改
export const scheduleCategoryUpdateService = (categoryData) => {
    return request.put('/schedule-category', categoryData)
}

//日程分类删除
export const scheduleCategoryDeleteService = (id) => {
    return request.delete('/schedule-category?id=' + id)
}

// 日程列表查询
export const scheduleListService = (params) => {
    // 发送 GET 请求获取日程列表，将参数作为查询参数传递
    return request.get('/schedule', {params: params});
};

// 日程添加
export const scheduleAddService = (scheduleData) => {
    // 发送 POST 请求添加新的日程，将日程数据作为请求体传递
    return request.post('/schedule', scheduleData);
};

// 日程修改
export const scheduleUpdateService = (scheduleData) => {
    // 发送 PUT 请求修改日程，将修改后的日程数据作为请求体传递
    return request.put('/schedule', scheduleData);
};

// 日程删除
export const scheduleDeleteService = (id) => {
    // 发送 DELETE 请求删除指定 ID 的日程
    return request.delete('/schedule?id=' + id);
};

//更新日程状态信息，使得日程变成“已完成”
export const scheduleUpdateStateService = (scheduleData) => {
    // 发送 PUT 请求修改日程，将修改后的日程数据作为请求体传递
    return request.put('/schedule/updateState', scheduleData);
};

export const scheduleSearchByDateService = (params) => {
    // 发送 PUT 请求修改日程，将修改后的日程数据作为请求体传递
    return request.get('/schedule/searchByDate', {params: params});
};